<?php $this->_extends('../_layouts/default_layout'); ?>
<?php $this->_block('contents'); ?>
<script type="text/javascript">
$(function(){
	$(".detail").colorbox({width:"90%", height:"80%", iframe:true});
	$(".datepicker").datepicker({dateFormat:'yy-mm-dd',changeMonth:true});
	$(".view").toggle(function(){
		$(this).parent().parent().next().show();
	},function(){
		$(this).parent().parent().next().hide();
	});
});
</script>
<fieldset><legend>查询条件</legend>
<form method="get">
<?include(Q::ini('custom_system/elements_dir') . 'searchform_element.php'); ?>
<table class="form_table">
<tr>
	<th>发送日期</th>
	<td colspan="3">
		<input type="text" name="begin_send_time" class="datepicker" value="<?=isset($_GET['begin_send_time']) ? $_GET['begin_send_time'] : ''?>" /> to 
		<input type="text" name="end_send_time" class="datepicker" value="<?=isset($_GET['end_send_time']) ? $_GET['end_send_time'] : ''?>" /> 
	</td>
</tr>
<tr>
	<th>仓库</th>
	<td>
		<select name="warehouse_id">
			<option value="">请选择..</option>
			<?foreach ($warehouse as $w):?>
			<option value="<?=$w['id']?>" <?if (isset($_GET['warehouse_id'])&&$_GET['warehouse_id']==$w['id'])echo "selected='selected'"?>><?=$w['name']?></option>
			<?endforeach;?>
		</select>
	</td>
</tr>
<tr>
	<th>物流公司</th>
	<td><input type="text" name="express_company" value="<?=isset($_GET['express_company']) ? $_GET['express_company'] : ''?>" /></td>
</tr>
<tr>
	<th>物流公司单号</th>
	<td><input type="text" name="express_number" value="<?=isset($_GET['express_number']) ? $_GET['express_number'] : ''?>" /></td>
</tr>
<tr>
	<th>追踪号</th>
	<td><input type="text" name="tracking_number" value="<?=isset($_GET['tracking_number']) ? $_GET['tracking_number'] : ''?>" /></td>
</tr>
<tr>
	<td></td>
	<td><input type="submit" class="button" value="查询" /></td>
</tr>
</table>
</form>
</fieldset>
<table width="98%" class="list_table">
<tr>
	<th>id</th>
	<th>仓库</th>
	<th>包裹数</th>
	<th>产品数</th>
	<th>重量</th>
	<th>体积</th>
	<th>物流公司</th>
	<th>物流公司单号</th>
	<th>追踪号</th>
	<th>运费</th>
	<th>税费</th>
	<th>发送时间</th>
	<th>预计入库时间</th>
	<th>实际入库时间</th>
	<th>财务审核人</th>
	<th>财务审核时间</th>
	<th>备注</th>
	<th>操作</th>
</tr>
<?foreach ($send_order as $so):?>
<tr height="35">
	<td>#<?=$so['id']?></td>
	<td><?=$so['warehouse_name']?></td>
	<td><?=$so['package_quantity']?></td>
	<td><?=$so['product_quantity']?></td>
	<td><?=$so['weight']?></td>
	<td><?=$so['volume']?></td>
	<td><?=$so['express_company']?></td>
	<td><?=$so['express_number']?></td>
	<td><?=$so['tracking_number']?></td>
	<td><?=$so['shipping_fee']?></td>
	<td><?=$so['tax_fee']?></td>
	<td><?=$so['send_time']?></td>
	<td><?=$so['budget_storage_time']?></td>
	<td><?=$so['actual_storage_time']?></td>
	<td><?=$so['finance_audit_user_id']?></td>
	<td><?=$so['finance_audit_time']?></td>
	<td><?=$so['notes']?></td>
	<td>	
	<a class="view" href="javascript:void(0);">查看</a>
	<a href="<?=url('Storage::Overseas/SendEdit', array('id' => $so['id']))?>">编辑</a>
	</td>
</tr>
<tr style="display: none;">
<td colspan="100%">
<table width="100%" class="list_table">
<tr>
<td colspan="10">采购单号</td>
<td colspan="10">金额</td>
</tr>
<?foreach ($so['items'] as $i):?>
<tr>
<td colspan="10">
<a class="detail" href="<?=url('Storage::Overseas/PurchaseOrderDetail', array('id'=>$i['id'], 'show_all' => false))?>" ><?=$i['number']?></a>
</td>
<td colspan="10"><?=$i['actual_amount']?></td>
</tr>
<?endforeach;?>
</table>
</td>
</tr>
<?endforeach;?>
</table>
<?=$page?>
<?php $this->_endblock(); ?>